<?php
namespace  App\Actions;

use Dcat\Admin\Admin;
use Exception;
use Illuminate\Support\Facades\Log;
use Throwable;

class BaseAction 
{
    public $admin_user;

    public function getAdminUser()
    {
        return Admin::guard()->check() ? Admin::user() : null;
    }
    /**
     * 返回错误信息，并打印出系统日志
     *
     * @param string $norma_message
     * @param string $system_message
     */
    public function error($norma_message, Throwable $th = null) {
        $th && Log::info($th->getMessage());
        throw new Exception($norma_message);
    }

    /**
     * Create a form instance.
     *
     * @param  mixed  ...$params
     * @return $this
     */
    public static function make(...$params)
    {
        return new static(...$params);
    }
}